import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '../views/Login/Login.vue';
import Main from '../views/Main/main.vue'
import Home from '../views/Home/home.vue'
import User from '../views/User/user.vue'
Vue.use(VueRouter);

// 清空路由规则
const routes = [
  {
    path: '/login',
    component: Login,
    name: 'login',
  },
  {
    path: '/', component: Main, children: [
      // path 为"空字符串"的子路由规则，叫做"默认子路由"
      { path: '', component: Home, name: 'home' },
      { path: '/user', component: User, name: 'user' }
    ]},
  // { path: '', component: Home, name: 'home' },***
  // { path: '/user', component: User, name: 'user' }
];

const router = new VueRouter({
  routes,
});

export default router;
